package cn.jasonone.tio.client.test;

import cn.jasonone.tio.tcp.annotations.EnableTioTcpClient;
import cn.jasonone.tio.tcp.client.TcpClient;
import cn.jasonone.tio.tcp.commons.Command;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.tio.client.TioClient;

import javax.annotation.Resource;

/**
 * @author xujie
 * @version 1.0
 * @date 2022/1/19 11:12
 */
@SpringBootApplication
@EnableTioTcpClient
public class TioClientApp implements ApplicationRunner {
    @Resource
    private TcpClient tcpClient;
    public static void main(String[] args) {
        SpringApplication.run(TioClientApp.class, args);
    }

    @Override
    public void run(ApplicationArguments args) throws Exception {
        tcpClient.send(CmdType.SYSTEM_MESSAGE, "测试消息", true);
        tcpClient.send(CmdType.NOTICE, "测试通知消息", true);
    }
}
